﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms.Design;

namespace HalconDotNet
{
	// Token: 0x02000011 RID: 17
	public class HWindowControlDesigner : ControlDesigner
	{
		// Token: 0x06000092 RID: 146 RVA: 0x00003FE0 File Offset: 0x000021E0
		public override void Initialize(IComponent component)
		{
			base.Initialize(component);
			this.windowControl = (HWindowControl)component;
		}

		// Token: 0x06000093 RID: 147 RVA: 0x00003FF8 File Offset: 0x000021F8
		protected override void PreFilterProperties(IDictionary properties)
		{
			base.PreFilterProperties(properties);
			Attribute[] attributes = new Attribute[]
			{
				CategoryAttribute.Layout,
				DesignOnlyAttribute.Yes,
				new DescriptionAttribute("This design-time property allows you to configure Size and ImagePart by providing a reference image of the desired size.")
			};
			properties["LayoutBitmap"] = TypeDescriptor.CreateProperty(typeof(HWindowControlDesigner), "LayoutBitmap", typeof(Bitmap), attributes);
			properties.Remove("BorderStyle");
		}

		// Token: 0x1700001B RID: 27
		// (get) Token: 0x06000094 RID: 148 RVA: 0x00004065 File Offset: 0x00002265
		// (set) Token: 0x06000095 RID: 149 RVA: 0x00004068 File Offset: 0x00002268
		public Bitmap LayoutBitmap
		{
			get
			{
				return null;
			}
			set
			{
				if (value != null)
				{
					HalconWindowLayoutDialog halconWindowLayoutDialog = new HalconWindowLayoutDialog(value.Size);
					halconWindowLayoutDialog.ShowDialog();
					if (!halconWindowLayoutDialog.resultCancel)
					{
						this.windowControl.WindowSize = new Size(value.Size.Width * halconWindowLayoutDialog.resultPercent / 100, value.Size.Height * halconWindowLayoutDialog.resultPercent / 100);
						this.windowControl.ImagePart = new Rectangle(Point.Empty, value.Size);
					}
				}
			}
		}

		// Token: 0x04000056 RID: 86
		private HWindowControl windowControl;
	}
}
